import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
// import { WsDemoModule } from './ws-demo/ws-demo.module';
import { YjsPostgresqlModule } from './yjs-postgresql/yjs-postgresql.module';
import { WsYjsGateway } from './ws-yjs/ws-yjs.gateway';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UserModule } from './user/user.module';
import { AuthModule } from './auth/auth.module';
import { JwtModule } from '@nestjs/jwt';
import { PageModule } from './page/page.module';

@Module({
  imports: [
    // WsDemoModule,
    WsYjsGateway,
    YjsPostgresqlModule.forRoot(),
    TypeOrmModule.forRoot({
      type: "postgres",
      host: "localhost",
      username: "postgres",
      port: 5432,
      password: "123456",
      database: "postgres",
      entities: [__dirname + "/**/*.entity{.ts,.js}"],
      synchronize: true
    }),
    JwtModule.register({
      global: true,
      secret: "MySecret",
      signOptions: { expiresIn: "1d" }
    }),
    UserModule,
    AuthModule,
    PageModule
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
